%PUT CREATING FILES...;

%LET TITLE2 = %LOOKUP(&COM);
TITLE2 "&TITLE2";

DATA &ELI (DROP = CREATEFILES_INDX); SET IN.EDIT20;

	/* SELECTION STATEMENTS */
	%MACRO DOTHIS;
		%IF %SYMEXIST(ELI) %THEN %DO;
			IF ELI = "&ELI";
		%END;
		%IF %SYMEXIST(CLUSTER) %THEN %DO;
			IF CLUSTER = "&CLUSTER";
		%END;
	%MEND;
	%DOTHIS;
	
	IF BSNS_TYPE_CD NE "";

	/* DEFINE VARIABLES */
	LNPRICE = LOG(FULLSAMP_EFFPR_WITX);
	QSTRING = OUTLET_CD || QT_CD || VER_CD;
	LNAMT = LOG(DER_SIZE*DER_QTY);
	IF LNAMT = . THEN DELETE;

	/* ITEM-SPECIFIC PRICE EDITS */
	%EDITS;	

	/* OUTLET DUMMIES */
	LGGROC = (BSNS_TYPE_CD = "572");
	DISCDEP = (BSNS_TYPE_CD IN ("401", "402"));
	SMGROC = (BSNS_TYPE_CD = "573");
	CONVENC = (BSNS_TYPE_CD IN ("574", "575"));
	WAREHS = (BSNS_TYPE_CD = "637");
	ARRAY STARRAY (5) LGGROC--WAREHS;
	DO CREATEFILES_INDX = 1 TO 5;
		IF BSNS_TYPE_CD = "" THEN STARRAY (CREATEFILES_INDX) = .;
	END;
	OTHSTORE = 1 - LGGROC - DISCDEP - SMGROC - CONVENC - WAREHS;
	STORECAT = LGGROC + 2*DISCDEP + 3*SMGROC + 4*CONVENC + 5*WAREHS + 6*OTHSTORE;

	/* ITEM-SPECIFIC VARIABLE DEFINITIONS */	
	%VARS;	
RUN;
